#ifndef DICTIONARYINTERFACE_H
#define DICTIONARYINTERFACE_H
#include <QString>
#include <QWidget>
#include <QList>
#include <QPair>
#include <QtPlugin>
#include <QIcon>

class DictionaryDescription
{
public:
    enum DictionaryLang {
        English = 0,
        Chinese,
        Sanskrit,
        Pali,
        German,
        Russian,
        French,
        Japanese,
        Korean
    };
    QString langToString(DictionaryLang lang) {
        switch(lang) {
        case English:
            return "English";
            break;
        case Chinese:
            return "Chinese";
            break;
        case Sanskrit:
            return "Sanskrit";
            break;
        case Pali:
            return "Pali";
            break;
        case German:
            return "German";
            break;
        case Russian:
            return "Russian";
            break;
        case French:
            return "French";
            break;
        case Japanese:
            return "Japanese";
            break;
        case Korean:
            return "Korean";
            break;
        default:
            return "Unknown";
            break;
        }
    }

    QString name() {
        return name_p;
    }
    QString shortname() {
        return shortname_p.mid(0, 16);
    }
    QString about() {
        return about_p;
    }
    DictionaryLang fromLang(){
        return fromLang_p;
    }
    DictionaryLang toLang(){
        return toLang_p;
    }
    QString version(){
        return version_p;
    }
    QIcon icon() {
        return icon_p;
    }


    void setName(QString n) {
        name_p = n;
    }
    void setShortName(QString sn){
        shortname_p = sn;
    }
    void setAbout(QString a) {
        about_p = a;
    }
    void setFromLang(DictionaryLang l) {
        fromLang_p = l;
    }
    void setToLang(DictionaryLang l) {
        toLang_p = l;
    }
    void setVersion(QString v) {
        version_p = v;
    }
    void setIcon(QIcon i){
        icon_p = i;
    }

private:
    QIcon icon_p;
    QString shortname_p;
    QString name_p;
    QString about_p;
    DictionaryLang fromLang_p;
    DictionaryLang toLang_p;
    QString version_p;
};

class DictionaryInterface
{
public:
    virtual ~DictionaryInterface() {}
    virtual QList<QPair<QString, QString> > getCandidateWords(QString key) = 0;
    virtual void queryWord(QString key) = 0;
    virtual DictionaryDescription getDescription() = 0;

    virtual QWidget *getToolbarFilterWidget() {
        return NULL;
    };

    virtual QString getTooltip(QString protocol, QString key) {
        Q_UNUSED(protocol);
        Q_UNUSED(key);
        return QString();
    };

    virtual QString getListFontName() {
        return QString();
    };

signals:
    void readyToShow(QString);
    void filterChanged();

};

QT_BEGIN_NAMESPACE
Q_DECLARE_INTERFACE(DictionaryInterface,
                    "Abhidhaana.Plugin.DictionaryInterface/1.0");
QT_END_NAMESPACE

#endif // DICTIONARYINTERFACE_H
